package collector.data;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;

public class StockMarket implements Iterable<StockList> {
	
	private String name;
	private HashMap<String,StockList> lists;
	private String code;
	public HashMap<String, StockList> getLists() {
		return lists;
	}

	public StockMarket(String code, String name) {
		this.code = code;
		this.name = name;
		this.lists = new HashMap<String,StockList>();
	}

	public String getCode() {
		return code;
	}
	
	public void addList(StockList list) {
		lists.put(list.getIdentifier(), list);
	}
	
	public ArrayList<Stock> findStock(String mixed) {
		return new ArrayList<Stock>();
	}

	public String getName() {
		return this.name;
	}

	public StockList getStocks() {
		StockList sl = new StockList(name);
		for (StockList l : lists.values())
			for (Stock s : l)
				sl.addStock(s);
		return sl;
	}

	@Override
	public Iterator<StockList> iterator() {
		return lists.values().iterator();
	}
}
